package com.androidx.p013lv.invention.view;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.player.C1387R;

/* renamed from: com.androidx.lv.invention.view.VideoView */
public class VideoView extends BaseView {
    LinearLayout btn_more;
    View itView;
    ImageView iv_cover;
    ImageView iv_type;
    RelativeLayout rl_content;
    TextView total_times;
    TextView tv_play_sum;
    TextView tv_title;
    TextView tv_title1;

    public VideoView(View view, Fragment fragment, String str, OnInventionType onInventionType) {
        super(view, fragment, str, onInventionType);
        this.itView = view;
        this.iv_type = (ImageView) view.findViewById(C1069R.C1072id.iv_type);
        this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
        this.tv_title1 = (TextView) view.findViewById(C1069R.C1072id.tv_title1);
        this.btn_more = (LinearLayout) view.findViewById(C1069R.C1072id.btn_more);
        this.tv_play_sum = (TextView) view.findViewById(C1069R.C1072id.tv_play_sum);
        this.total_times = (TextView) view.findViewById(C1069R.C1072id.total_times);
        this.iv_cover = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
        RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(C1069R.C1072id.rl_content);
        this.rl_content = relativeLayout;
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) relativeLayout.getLayoutParams();
        layoutParams.height = ((UiUtils.getWindowWidth() - UiUtils.dp2px(12)) * 9) / 16;
        this.rl_content.setLayoutParams(layoutParams);
    }

    @Override // com.androidx.p013lv.invention.view.BaseView
    public void setView(InventionBean inventionBean, int i) {
        super.setView(inventionBean, i);
        this.tv_title1.setText(inventionBean.getStationName());
        this.btn_more.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.VideoView.View$OnClickListenerC12031 */

            public void onClick(View view) {
                VideoView.this.onInventionType.onClick(VideoView.this.inventionBean, VideoView.this.position, view.getId());
            }
        });
        final VideoBean videoBean = inventionBean.getVideoList().get(0);
        if (videoBean != null) {
            if (videoBean.getVideoType() == 1) {
                this.iv_type.setImageResource(C1387R.C1389drawable.ic_vip);
                TextView textView = this.tv_title;
                textView.setText("  " + videoBean.getTitle());
            } else if (videoBean.getVideoType() == 2) {
                this.iv_type.setImageResource(C1387R.C1389drawable.ic_pay);
                TextView textView2 = this.tv_title;
                textView2.setText("   " + videoBean.getTitle());
            } else {
                this.iv_type.setImageDrawable(null);
                this.tv_title.setText(videoBean.getTitle());
            }
            TextView textView3 = this.tv_play_sum;
            textView3.setText(UiUtils.num2str(videoBean.getFakeWatchNum()) + "");
            this.total_times.setText(TimeUtils.stringForTime(videoBean.getPlayTime() * 1000));
            if (videoBean.getCoverImg() == null || videoBean.getCoverImg().size() <= 0) {
                GlideUtils.loadCropRadiusDefault(this.fragment, 4, this.iv_cover);
            } else {
                Fragment fragment = this.fragment;
                GlideUtils.loadCropRadiusWh2(fragment, this.domain + videoBean.getCoverImg().get(0), 4, this.iv_cover, 600);
            }
            int type = inventionBean.getType();
            if (type == 11) {
                this.itView.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.view.VideoView.View$OnClickListenerC12042 */

                    public void onClick(View view) {
                        ARouter.getInstance().build(Constance.VIDEO_ACTIVITY).navigation();
                    }
                });
            } else if (type == 18) {
                this.itView.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.view.VideoView.View$OnClickListenerC12053 */

                    public void onClick(View view) {
                        ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(videoBean.getVideoId())).navigation();
                    }
                });
            }
        }
    }
}
